< previous page page_496 next page >

Page 496
e10a6a0a59f035e870d90cca05b85fce.gif
            oldpoints(i, j) = points(i, j)
        Next j
    Next i

    ' Resize and initialize the Points array.
    oldx = NumX
    oldz = NumZ
    SetBounds Xmin, Dx / factor, newx, _
              Zmin, Dz / factor, newz

    ' Move the old data to the new positions.
    newi = 1
    For i = 1 To oldx
        newj = 1
        For j = 1 To oldz
             points(newi, newj) = oldpoints(i, j)
             newj = newj + factor
        Next j
        newi = newi + factor
    Next i

    ' Subdivide each area in the data.
    newi = 1
    For i = 2 To oldx
        newj = 1
        For j = 2 To oldz
            Subdivide newi, newi + factor, _
                      newj, newj + factor, Dy
            newj = newj + factor 
        Next j
        newi = newi + factor 
    Next i
End Sub

' Recursively subdivide the indicated area. 
Private Sub Subdivide(ByVal i1 As Integer, _ 
    ByVal i2 As Integer, ByVal j1 As Integer, _ 
    ByVal j2 As Integer, ByVal Dy As Single) 
Dim y11 As Single
Dim y12 As Single
Dim y21 As Single
Dim y22 As Single
Dim imid As Integer
Dim jmid As Integer

    If (i2 - i1 <= 1) Or (j2 - j1 <= 1) Then Exit Sub

    ' Compute the midpoint locations.
    y11 = points(i1, j1).coord(2)
    y12 = points(i1, j2).coord(2)
    y21 = points(i2, j1).coord(2)
    y22 = points(i2, j2).coord(2)

 
< previous page page_496 next page >